import request from '@/utils/request'

const api_name = '/eduservice/chapter'

export default {
  //1. 获取章节树形数据
  getNestedTreeList(courseId) {
    return request({
      url: `${api_name}/getChapterVideo/${courseId}`,
      method: 'get'
    })
  },
  //2. 根据ID删除章节
  removeById(id) {
    return request({
      url: `${api_name}/${id}`,
      method: 'delete'
    })
  },
  //3. 新增章节
  save(chapter) {
    return request({
      url: `${api_name}/saveChapter`,
      method: 'post',
      data: chapter
    })
  },
  //4. 根据ID查询章节
  getById(id) {
    return request({
      url: `${api_name}/${id}`,
      method: 'get'
    })
  },
  //5. 修改章节
  updateById(chapter) {
    return request({
      url: `${api_name}/upChapterDate`,
      method: 'post',
      data: chapter
    })
  }
}
